package com.yhc.my.an_meishia.adapters;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.yhc.my.an_meishia.fragments.HotFragment;
import com.yhc.my.an_meishia.utils.PATH;

/**
 * Created by Administrator on 2016/9/19 0019.
 */
public class TabAdapter extends FragmentPagerAdapter {


    private static String[] title = {"热门", "搞笑", "美妆时尚", "#美食#", "#吃秀#", "#音乐#", "#舞蹈#", "宝宝", "明星名人", "女神", "涨姿势", "#宠物#", "男神", "#逛拍#"};
    private HotFragment fragment;
    private Bundle bundle;


    public TabAdapter(FragmentManager fm) {
        super(fm);

    }


    @Override
    public Fragment getItem(int position) {
        switch (position) {
            case 0:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("pos", PATH.HOT);
                fragment.setArguments(bundle);
                break;
            case 1:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("pos", PATH.Happy);
                fragment.setArguments(bundle);
                break;
            case 2:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("pos", PATH.WOMEN);
                fragment.setArguments(bundle);
                break;
            case 3:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("pos", PATH.STAR);
                fragment.setArguments(bundle);
                break;
            case 4:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("pos", PATH.ZY);
                fragment.setArguments(bundle);
                break;
            case 5:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("pos", PATH.BABY);
                fragment.setArguments(bundle);
                break;
            case 6:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("pos", PATH.DANCE);
                fragment.setArguments(bundle);
                break;
            case 7:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("pos", PATH.EAT);
                fragment.setArguments(bundle);
                break;
            case 8:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("pos", PATH.EAT_SHOW);
                fragment.setArguments(bundle);
                break;
            case 9:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("pos", PATH.MUSIC);
                fragment.setArguments(bundle);
                break;
            case 10:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("pos", PATH.PAT);
                fragment.setArguments(bundle);
                break;
            case 11:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("pos", PATH.SH);
                fragment.setArguments(bundle);
                break;
            case 12:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("pos", PATH.MAN);
                fragment.setArguments(bundle);
                break;
            case 13:
                fragment = new HotFragment();
                bundle = new Bundle();
                bundle.putString("pos", PATH.IMAN);
                fragment.setArguments(bundle);
                break;
        }
        return fragment;
    }

    @Override
    public int getCount() {
        return title.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return title[position];
    }
}
